package com.xuxin.baby.adapter;

import android.widget.ImageView;

import com.blankj.utilcode.util.LogUtils;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuxin.baby.R;
import com.xuxin.baby.bean.OrderCommitBean;
import com.xuxin.baby.glide.GlideApp;
import com.xuxin.baby.network.Retrofit;

import org.jetbrains.annotations.NotNull;

/**
 * Created by xu_xin
 * Created on 2020.08.04 0004
 * 提交订单
 */
public class OrderCommitAdapter extends BaseQuickAdapter<OrderCommitBean.DetailsBean, BaseViewHolder> {
    RequestOptions options = new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10));

    public OrderCommitAdapter() {
        super(R.layout.item_order_commit);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, OrderCommitBean.DetailsBean itemsBean) {
        holder.setText(R.id.item_order_commit_name, itemsBean.getTitle());
        holder.setText(R.id.item_order_commit_content, itemsBean.getContent());
        holder.setText(R.id.item_order_commit_price, itemsBean.getUnitBean()+"");
        /**
         * 加载图片
         */
        ImageView item_order_commit_image = holder.getView(R.id.item_order_commit_image);
        String videoImage = Retrofit.image_url + itemsBean.getImage();
        LogUtils.e("提交订单_image = " + videoImage);
        GlideApp.with(getContext()).load(videoImage).placeholder(R.mipmap.img_placeholder260).apply(options).into(item_order_commit_image);
    }
}